<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>服务修改 - Layui</title>
<link rel="stylesheet" href="/layui/css/layui.css">
<link rel="stylesheet" href="/css/admin.css">
</head>
<body  style="background-color:#F1F1F1">
    <div style="width: 500px;margin-top: 35px">
       <input type="hidden" name="thispid" value="<?php echo $str['pid'];?>" class='thispid'>
      <div class="layui-form-item">
        <label class="layui-form-label">服务名称</label>
        <div class="layui-input-block">
          <input type="text" name="svname" lay-verify="required" value="<?php echo $str['svname']?>" autocomplete="off" class="layui-input svname">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">价格</label>
        <div class="layui-input-block">
          <input type="text" name="price" lay-verify="required" value="¥<?php echo $str['price']?>" autocomplete="off" class="layui-input price">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">服务内容</label>
         <div class="layui-input-block">
          <textarea placeholder="服务的具体内容" class="layui-textarea content" name="content"><?php echo $str['content']?></textarea>
         </div>
      </div>
      <div class="layui-input-block">
        <button class="layui-btn" lay-submit="" lay-filter="demo1">确认修改</button>          
      </div>
    </div>

</body>
</html>
<script src="/layui/layui.js"></script>
<script type="text/javascript">

layui.use(['layer', 'jquery'], function(){
  var layer = layui.layer;
  var $ = layui.jquery;
  console.log($);
  var index = parent.layer.getFrameIndex(window.name);
  $(function(){
  $('.layui-btn').click(function(){
    var svname = $('.svname').val();
    var price = $('.price').val();
    var content = $('.content').val();
    var id = $('.thispid').val();
    // layer.msg(content);
      $.ajax({
      url:"/admin/service/dochange",
      type:'post',
      data:{'svname':svname,'price':price,'content':content,'id':id},
      dataType:'json',
      success:function(d){
        if(d.code==20){  
          layer.msg(d.msg,{
            icon:1,
            time:1000},
            function(){
                parent.layer.close(index);
          });        
        }else{
          layer.msg(d.msg,{
            icon:2,
            time:1000,
            });
        }
      }
    })





    })










  })


})

</script>



